package me.jessyan.mvparms.demo.data.api.service;

import io.reactivex.Observable;
import me.jessyan.mvparms.demo.data.entity.MessageInfoEntity;
import me.jessyan.mvparms.demo.data.entity.TopResponse;
import me.jessyan.mvparms.demo.data.entity.UploadImgEntity;
import okhttp3.MultipartBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;

/**
 * @Author: 海洋
 * @Date: 2018/8/23
 * @Desc:
 */
public interface RichEditorService {
    /**
     *
     * @param imgs
     * @return
     */
    @Multipart
    @POST("/message/UploadImg")
    Observable<TopResponse<UploadImgEntity>> uploadImage(@Part MultipartBody.Part imgs);

    /**
     * 通过id获取公告内容
     * @param id id
     * @return
     */
    @FormUrlEncoded
    @POST("/message/info")
    Observable<TopResponse<MessageInfoEntity>> getMessageInfoById(@Field("id") String id);

    /**
     * 添加公告
     * @param title 标题
     * @param content 内容
     * @return
     */
    @FormUrlEncoded
    @POST("/message/add")
    Observable<TopResponse<Object>> addMessage(@Field("title") String title, @Field("content") String content);

    /**
     *修改公告
     * @param id 公告id
     * @param title 标题
     * @param content 内容
     * @return
     */
    @FormUrlEncoded
    @POST("/message/edit")
    Observable<TopResponse<Object>> editMessage(@Field("id") String id, @Field("title") String title, @Field("content") String content);
}
